import {post} from '../../../utils/axios'

const state = {
  name: '初始化情况',
  active: null,
  text: '1',
  count: '',
  info: []
}

const mutations = {
  loadProjectInfo (state, payload) {
    let url = '/project/project_info/'
    post(url, {
      opt: payload
    }).then((response) => {
      state.info = JSON.parse(response).info
      state.count = response.count
    }).catch((error) => {
      console.log(error.response.data.detail)
    })
  },
  closeProjectInfo (state) {
    this._vm.$data.$$state.listproject.infoDialog = false
  }
}

const actions = {
  closeProjectInfo ({commit}) {
    commit('closeProjectInfo')
  },
  loadProjectInfo ({commit}, payload) {
    commit('loadProjectInfo', payload)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
